// @flow
import React, { Component } from 'react';
import { Form, Icon, Input, Button, Checkbox, TreeSelect, Switch } from 'antd';
import './EditAccount.scss';

type Props = { form: any, treeData: any, value: string };

const EditAccount = (props: Props) => {
  const { getFieldDecorator } = props.form;
  const { treeData, value } = props;
  const treeData1 = [
    {
      code: '1',
      title: '资产类(Assets)',
      value: '1',
      key: '1',
      level: 0,
      children: [
        {
          code: '1001',
          title: '库存现金',
          value: '1-1',
          key: '1-1',
          level: 1,
          children: [
            {
              code: '1001001',
              title: 'cash',
              value: '1-1-1',
              key: '1-1-1',
              level: 2,
            },
          ],
        },
      ],
    },
    {
      title: 'Node2',
      value: '0-1',
      key: '0-1',
    },
  ];
  const FormItem = Form.Item;
  // const Option = Select.Option;
  return (
    <div className="EditAccount">
      <Form>
        <Form.Item>
          <span>上级节点</span>
          <TreeSelect
            style={{ width: 300 }}
            value={value}
            dropdownStyle={{ maxHeight: 400, overflow: 'auto' }}
            treeData={treeData1}
            placeholder="Please select"
            treeDefaultExpandAll
            onChange={this.onChange}
          />
        </Form.Item>
        <Form.Item>
          <span>Code</span>
          <Input
            style={{ width: 300 }}
            value={value}
            placeholder="Please select"
            onChange={this.onChange}
          />
        </Form.Item>
        <Form.Item>
          <span>Title</span>
          <Input
            style={{ width: 300 }}
            value={value}
            placeholder="Please select"
            onChange={this.onChange}
          />
        </Form.Item>
        <Switch checkedChildren="有效" unCheckedChildren="无效" defaultChecked />
      </Form>
    </div>
  );
};

export default Form.create()(EditAccount);
